<template>
  <div class="app">
    <header class="header">
      <h1>HJR UI - Vue 3 Component Library</h1>
      <p>A modern component library built with Vue 3 and Vite</p>
    </header>
    
    <main class="main">
      <section class="section">
        <h2>Button Components</h2>
        <div class="demo-row">
          <HjrButton >Default Button</HjrButton>
          <HjrButton type="primary">Primary Button</HjrButton>
          <HjrButton type="success">Success Button</HjrButton>
          <HjrButton type="warning">Warning Button</HjrButton>
          <HjrButton type="danger">Danger Button</HjrButton>
        </div>
      </section>

      <section class="section">
        <h2>Input Components</h2>
        <div class="demo-row">
          <HjrInput placeholder="Enter text..." />
          <HjrInput type="password" placeholder="Enter password..." />
        </div>
      </section>

      <section class="section">
        <h2>Card Components</h2>
        <div class="demo-row">
          <HjrCard title="Sample Card" style="width: 300px;">
            <p>This is a sample card component with some content.</p>
            <template #footer>
              <HjrButton type="primary" size="small">Action</HjrButton>
            </template>
          </HjrCard>
        </div>
      </section>

      <section class="section">
        <h2>Modal Components</h2>
        <div class="demo-row">
          <HjrButton @click="showModal = true">Open Modal</HjrButton>
          <HjrModal v-model:visible="showModal" title="Sample Modal">
            <p>This is a sample modal content.</p>
            <template #footer>
              <HjrButton @click="showModal = false">Cancel</HjrButton>
              <HjrButton type="primary" @click="showModal = false">Confirm</HjrButton>
            </template>
          </HjrModal>
        </div>
      </section>

      <section class="section">
        <h2>Select Components</h2>
        <div class="demo-row">
          <div style="width: 200px;">
            <HjrSelect v-model="selectedValue" :options="selectOptions" placeholder="请选择选项" />
          </div>
        </div>
      </section>

      <section class="section">
        <h2>Switch Components</h2>
        <div class="demo-row">
          <HjrSwitch v-model="switchValue" />
          <span style="margin-left: 10px;">Switch: {{ switchValue ? 'ON' : 'OFF' }}</span>
        </div>
        <div class="demo-row">
          <HjrSwitch v-model="switchValue2" size="small" />
          <HjrSwitch v-model="switchValue3" size="medium" />
          <HjrSwitch v-model="switchValue4" size="large" />
        </div>
      </section>

      <section class="section">
        <h2>Alert Components</h2>
        <div class="demo-row" style="flex-direction: column; align-items: stretch;">
          <HjrAlert type="success" title="Success" message="This is a success message!" closable />
          <HjrAlert type="warning" title="Warning" message="This is a warning message!" closable />
          <HjrAlert type="error" title="Error" message="This is an error message!" closable />
          <HjrAlert type="info" title="Info" message="This is an info message!" closable />
        </div>
      </section>
    </main>
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      showModal: false,
      selectedValue: '',
      switchValue: false,
      switchValue2: true,
      switchValue3: false,
      switchValue4: true,
      selectOptions: [
        { value: 'option1', label: '选项 1' },
        { value: 'option2', label: '选项 2' },
        { value: 'option3', label: '选项 3' },
        { value: 'option4', label: '选项 4' }
      ]
    }
  }
}
</script>

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.app {
  min-height: 100vh;
  background: #f5f5f5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-align: center;
  padding: 60px 20px;
}

.header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.header p {
  font-size: 1.2rem;
  opacity: 0.9;
}

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

.section {
  background: white;
  border-radius: 8px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.section h2 {
  margin-bottom: 20px;
  color: #333;
  font-size: 1.5rem;
}

.demo-row {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: center;
}
</style>
